; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=mips64-unknown-linux < %s | FileCheck %s

define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*){
; CHECK-LABEL: main:
; CHECK:       # %bb.0:
; CHECK-NEXT:    daddiu $sp, $sp, -16
; CHECK-NEXT:    .cfi_def_cfa_offset 16
; CHECK-NEXT:    sd $ra, 8($sp) # 8-byte Folded Spill
; CHECK-NEXT:    .cfi_offset 31, -8
; CHECK-NEXT:  .Ltmp0:
; CHECK-NEXT:    jal foo
; CHECK-NEXT:    nop
; CHECK-NEXT:  .Ltmp1:
; CHECK-NEXT:  # %bb.1: # %good
; CHECK-NEXT:    addiu $2, $zero, 5
; CHECK-NEXT:    ld $ra, 8($sp) # 8-byte Folded Reload
; CHECK-NEXT:    jr $ra
; CHECK-NEXT:    daddiu $sp, $sp, 16
; CHECK-NEXT:  .LBB0_2: # %bad
; CHECK-NEXT:  .Ltmp2:
; CHECK-NEXT:    jal _Unwind_Resume
; CHECK-NEXT:    nop
  %1 = invoke i32 @foo() to label %good unwind label %bad
good:
  ret i32 5
bad:
  %2 = landingpad { i8*, i32 }
  cleanup
  resume { i8*, i32 } %2
}

declare i32 @foo()
declare i32 @__gxx_personality_v0(...)
